<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui" >

<head>

</head>
<body>


	<ui:composition template="../WEB-INF/layout/template.xhtml">
		<ui:define name="title"><h:outputText value="#{msg.add_translator}" /></ui:define>
		<ui:define name="content">
		
		<h:form id="translatorForm">

			<p:panel header="#{msg.details}">

				<h:panelGrid columns="5">
					<h:panelGroup>
						<h:outputText value="#{msg.first_name}"/><br/>
						<p:inputText id="firstname" value="#{inserisciTraduttoreBean.translatorInput.firstName}" validator="genericNameValidator" required="true" size="15"/><br/>
						<p:message for="firstname"/>
					</h:panelGroup>
					<h:panelGroup>
						<h:outputText value="#{msg.surname}"/><br/>
						<p:inputText id="surname" value="#{inserisciTraduttoreBean.translatorInput.surname}"  validator="genericNameValidator" required="true" size="15"/><br/>
						<p:message for="surname"/>
					</h:panelGroup>
					<h:panelGroup>
						<h:outputText value="#{msg.citizenship}"/><br/>
						<p:inputText id="cit" value="#{inserisciTraduttoreBean.translatorInput.citizenship}" required="true" size="15"/><br/>
						<p:message for="cit"/>
					</h:panelGroup>
					<h:panelGroup>
						<h:outputText value="#{msg.passport_number}"/><br/>
						<p:inputText id="pass" value="#{inserisciTraduttoreBean.translatorInput.passportNumber}" validator="alphaNumericValidator" required="false" size="15"/><br/>
						<p:message for="pass"/>
					</h:panelGroup>
					<h:panelGroup>
						<h:outputText value="#{msg.registration_number}"/><br/>
						<p:inputText id="reg" value="#{inserisciTraduttoreBean.translatorInput.registrationNumber}" validator="alphaNumericValidator" required="false" size="15"/><br/>
						<p:message for="reg"/>
					</h:panelGroup>
				</h:panelGrid>
				
				<h:panelGrid columns="2">
					<p:dataTable value="#{inserisciTraduttoreBean.translatorInput.emails}" var="email">
						<f:facet name="header">
							#{msg.emails}
						</f:facet>
						<p:column>
							<f:facet name="header">
								#{msg.email}
							</f:facet>
							<p:inputText id="email" value="#{email.email}" validator="emailValidator" required="true" size="25"/><br/>
							<p:message for="email"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.type}
							</f:facet>
							<h:selectOneMenu value="#{email.type}">
								<f:selectItems value="#{inserisciTraduttoreBean.emailTypeOptions}"/>
							</h:selectOneMenu>
						</p:column>
						<p:column>
							<p:commandButton value="X" action="#{inserisciTraduttoreBean.translatorInput.removeEmail}" update="translatorForm msgs growl" process="@this">
								<f:setPropertyActionListener value="#{email}" target="#{inserisciTraduttoreBean.translatorInput.emailToRemove}" />
							</p:commandButton>
						</p:column>
						<f:facet name="footer">
							<p:commandButton value="+" actionListener="#{inserisciTraduttoreBean.translatorInput.addEmptyEmail}" update="translatorForm growl msgs"/>
						</f:facet>
					</p:dataTable>					
							
					<p:dataTable value="#{inserisciTraduttoreBean.translatorInput.telephones}" var="phone">
						<f:facet name="header">
							#{msg.phones}
						</f:facet>
						<p:column>
							<f:facet name="header">
								#{msg.number}
							</f:facet>
							<p:inputText id="number" value="#{phone.number}" validator="telefonoValidator" required="true" size="15"/><br/>
							<p:message for="number"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.type}
							</f:facet>
							<h:selectOneMenu value="#{phone.type}">
								<f:selectItems value="#{inserisciTraduttoreBean.phoneTypeOptions}"/>
							</h:selectOneMenu>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.country}
							</f:facet>
							<h:selectOneMenu value="#{phone.country}">
								<f:selectItems value="#{inserisciTraduttoreBean.phoneCountryOptions}"/>
							</h:selectOneMenu>
						</p:column>
						<p:column>
							<p:commandButton value="X" action="#{inserisciTraduttoreBean.translatorInput.removeTelephone}" update="translatorForm msgs growl" process="@this">
								<f:setPropertyActionListener value="#{phone}" target="#{inserisciTraduttoreBean.translatorInput.phoneToRemove}" />
							</p:commandButton>
						</p:column>
						<f:facet name="footer">
							<p:commandButton value="+" actionListener="#{inserisciTraduttoreBean.translatorInput.addEmptyPhone}" update="translatorForm growl msgs"/>
						</f:facet>
					</p:dataTable>	
			</h:panelGrid>
			
			<h:panelGrid columns="1">
				<p:dataTable value="#{inserisciTraduttoreBean.translatorInput.indirizziIt}" var="indit">
					<f:facet name="header">
						#{msg.residence_addresses}
					</f:facet>
					<p:column>
						<f:facet name="header">
							#{msg.address_line_1}
						</f:facet>
						<p:inputText id="addr1" value="#{indit.indirizzoLinea1}" size="25" required="true"/><br/>
						<p:message for="addr1"/>
					</p:column>
					<p:column>
						<f:facet name="header">
							#{msg.town}
						</f:facet>
						<p:autoComplete id="townit" value="#{indit.citta}" completeMethod="#{inserisciTraduttoreBean.completeTownIt}" size="15" required="true"/><br/>
						<p:message for="townit"/>
					</p:column>
					<p:column>
						<f:facet name="header">
							#{msg.province}
						</f:facet>
						<p:inputText id="prov" value="#{indit.provincia}" size="15" required="true"/><br/>
						<p:message for="prov"/>
					</p:column>
					<p:column>
						<f:facet name="header">
							#{msg.country}
						</f:facet>
						<p:inputText id="country" value="#{indit.paese}" size="15" required="true"/><br/>
						<p:message for="country"/>
					</p:column>
					<p:column>
						<f:facet name="header">
							#{msg.cap}
						</f:facet>
						<p:inputText id="cap" value="#{indit.cap}" validator="capValidator" size="5" required="true"/><br/>
						<p:message for="cap"/>
					</p:column>
					<p:column>
						<p:commandButton value="X" action="#{inserisciTraduttoreBean.translatorInput.removeIndIt}" update="translatorForm msgs growl" process="@this">
							<f:setPropertyActionListener value="#{indit}" target="#{inserisciTraduttoreBean.translatorInput.indItToRemove}" />
						</p:commandButton>
					</p:column>
					<f:facet name="footer">
						<p:commandButton value="+" action="#{inserisciTraduttoreBean.translatorInput.addEmptyIndIt}" update="translatorForm growl msgs"/>
					</f:facet>
				</p:dataTable>
			</h:panelGrid>
			
			<h:panelGrid columns="1">
				<p:dataTable value="#{inserisciTraduttoreBean.translatorInput.indirizziAu}" var="indau">
					<f:facet name="header">
						#{msg.australian_addresses}
					</f:facet>
					<p:column>
						<f:facet name="header">
							#{msg.address_line_1}
						</f:facet>
						<p:inputText id="addr1" value="#{indau.indirizzoLinea1}" size="25" required="true"/><br/>
						<p:message for="addr1"/>
					</p:column>
					<p:column>
						<f:facet name="header">
							#{msg.town}
						</f:facet>
						<p:autoComplete id="townau" value="#{indau.citta}" completeMethod="#{inserisciTraduttoreBean.completeTownAu}" size="15" required="true"/><br/>
						<p:message for="townau"/>
					</p:column>
					<p:column>
						<f:facet name="header">
							#{msg.state}
						</f:facet>
						<h:selectOneMenu id="state" value="#{indau.stato}">
							<f:selectItems value="#{inserisciTraduttoreBean.stateOptions}"/>
						</h:selectOneMenu>
						<p:message for="state"/>
					</p:column>
					<p:column>
						<f:facet name="header">
							#{msg.country}
						</f:facet>
						<p:inputText id="country" value="#{indau.paese}" size="15" required="true"/><br/>
						<p:message for="country"/>
					</p:column>
					<p:column>
						<f:facet name="header">
							#{msg.post_code}
						</f:facet>
						<p:inputText id="postcode" value="#{indau.postCode}" validator="postCodeValidator" size="5" required="true"/><br/>
						<p:message for="postcode"/>
					</p:column>
					<p:column>
						<p:commandButton value="X" action="#{inserisciTraduttoreBean.translatorInput.removeIndAu}" update="translatorForm msgs growl" process="@this">
							<f:setPropertyActionListener value="#{indau}" target="#{inserisciTraduttoreBean.translatorInput.indAuToRemove}" />
						</p:commandButton>
					</p:column>
					<f:facet name="footer">
						<p:commandButton value="+" action="#{inserisciTraduttoreBean.translatorInput.addEmptyIndAu}" update="translatorForm growl msgs"/>
					</f:facet>
				</p:dataTable>		
			</h:panelGrid>
			
			</p:panel>	
			
			<p:growl id="growl"/>
		
			<p:messages id="msgs"/>
			
			<p>
				<center>
					<p:commandButton value="#{msg.submit}" action="#{inserisciTraduttoreBean.submit}" update="translatorForm growl msgs"/>
				</center>
			</p>
			
			
			
			</h:form>
			
		</ui:define>
	</ui:composition>



</body>
</html>
